﻿using B.S.Filtration.Domain;
using B.S.Filtration.ErrorCode;
using B.S.Filtration.Read.Api.Application.Command.ProcessCommand;
using B.S.Filtration.Read.Api.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Filtration.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GetProcessController : ControllerBase
    {
        private readonly IMediator mediator;

        public GetProcessController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 工序列表反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<Process>>> FTProcess([FromQuery]FTProcessCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序列表显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<APIPaging<Process>>> GetProcessC([FromQuery]GetProcessCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 工序分类分页显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<APIPaging<ProcessType>>> GetProcessType([FromQuery]GetProcessTypeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 工序分页显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<APIPaging<ProcedureDTO>>> GetProcedure([FromQuery]GetProcedureCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 工序分类无分页显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<ProcessType>>> GetType([FromQuery]GetTypeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 工艺分页显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<APIPaging<Craftsmanship>>> GetCraftsmanship([FromQuery]GetCraftsmanshipCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 根据ID获取工艺显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<Craftsmanship>>> GetBYIdCraftsmanship([FromQuery]GetBYIdCraftsmanshipCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 根据ID获取工序显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<CraftProcedureDTO>>> GetBYIdCraftProcedure([FromQuery]GetBYIdCraftProcedureCommand request)
        {
            return await mediator.Send(request);
        }

    }
}
